//
// Created by Flower_LC on 2022/10/15.
//
#include<stdio.h>
#include<string.h>
#include<math.h>
#define MAXN 100

int L[MAXN] = {0};

int main(){
    int n, k, m;
    int getIndex(int, int, int); // 根据起始位置, 步长, 个数确定下一个被指到的位置

    while(scanf("%d%d%d", &n, &k, &m) == 3 && n != 0){
        int count = 0; // 已经打印了多少个数字
        memset(L, 0, sizeof(L));
        int A = 1, B = n;
        while(count < n){
            A = getIndex(A, n, k);
            B = getIndex(B, n, -m);
            printf("%3d", A);
            L[A] = 1;
            count++;
            if(count == n){
                putchar('\n');
                break;
            }
            else{
                if(A == B) printf(",");
                else{
                    printf("%3d", B);
                    L[B] = 1;
                    count++;
                    if(count == n){
                        putchar('\n');
                        break;
                    }
                    putchar(',');
                }
            }
        }
    }
    return 0;
}

int getIndex(int begin, int n, int step){
    // 根据step正负判断方向
    bool flag = false;
    if (step < 0) flag = true;

    step = abs(step);
    int count = 0, i = begin;
    while(count < step){
        if(L[i] == 0){
            count++;
            if(count == step) return i;
        }
        i = flag ? i -1 : i + 1;
        if(i < 1){
            i = i + n;
        }
        else if(i > n){
            i = i % n;
        }
    }
}